-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test(a3p): test mintHolder functionalities after contract null upgrade #10617
Conversation
Deploying agoric-sdk with Cloudflare Pages
|
fb05f20
to
9e49ac7
Compare
When choosing assets to start with in upgrading MintHolders on mainNet, I'd like to start with a few that don't have the highest values at stake. When I look at the interProtocol dashboard (https://info.inter.trade/psm?chain=mainnet), I see that USDC and DAI_axelar have the highest amounts. I don't see a dashboard that lists BLD, but I'd expect it to be very high. For vaults, I see stOSMO, stATOM, and stTIA having the highest collateral values. The mintHolder vats on MainNet include BLD, ATOM, USDC_axl, USDC_grv, USDT_axl, USDT_grv, DAI_axl, DAI_grv, stATOM, USDC, USDT, stOSMO, stTIA, and stkATOM. Rather than starting with BLD, ATOM and USDC, on MainNet, let's start with ATOM, USDC_axl, USDC_grv, USDT_axl, USDT, and stkATOM. I'd like the test to trade some of the currency with a PSM or Vault. (Whichever is easier; it's not valuable to do both.) Oh, I don't want this PR to have to create PSMs or add vault types, so it makes more sense to use the vaults and PSMs that exist in
Yeah, it should be a single script that takes a parameter to say which vat/currency. |
a3p-integration/proposals/z:acceptance/mint-test-submission/send-script.tjs
Outdated
Show resolved
Hide resolved
]); | ||
|
||
const mintHolderKit = Array.from(contractKits.values()).filter( | ||
kit => kit.label && kit.label.match(/ATOM/), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lots of vats have ATOM
in their names. Let's find a better way to uniquely identify the mintHolder vat.
The name also has 'mintHolder' in it, so that's not unique yet. On MainNet, there are vats for ATOM, stATOM, and stkATOM as well as two different kinds of USDC, USDC, and DAI. should we specify the vat number, which is unique (though different) on each platform?
I think I'll post something to the kernel team. They often have opinions and ideas about this kind of thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think everyone would be satisfied if we first filter for the installation, and then look for the exact name. At the moment, there's only one installation for mintHolder, so we can just get the unique mintHolder installation from the promise space.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please clarify if you meant instance
instead of installation
?
I am asking because, if I am not mistaken, the contractKits only hold the contract instance, adminFacet, creatorFacet and publicFacet.
And if that is the case, from where can we retrieve the mintHolder Instance in order to compare it with the ones recorded in the contractKits?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did mean installation
, but you're right, that's not available. I was happy with that because one installation
is shared across many instances. The instances aren't helpful for this.
The vat names are unique, but the label
s used in contractKits
are just the issuer name.
Dan had suggested using __getMethodNames__()
on the publicFacet to distinguish mintHolders
. The publicFacet of a mintHolder
is the issuer
itself. (I didn't realize you could call that on a remote reference, but Dan thinks so.) If you use an exact match on the label, and verify that the publicFacet has a makeEmptyPurse
method, then I'll be comfortable that you've found the right contract and it's a mintHolder. Does that work? Is the issuer name used for the label sufficient to distinguish the varieties of USDT and DAI?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests showed that using strict equality operator to compare the label with the issuer name, is indeed capable of distinguish the varieties of USDT, USDC and DAI assets.
I was not able to find an example of getMethodNames() being used on Agoric code, and I while trying different implementations for it, I was not successful to find one that would return a list of exposed methods by the mintHolder publicFacet.
Although, at commit b9c5acb, I followed the approach you suggested by calling the makeEmptyPurse
method and verify that the core-eval did not throw during the test execution.
Is this sufficient to confirm that we are interacting with the expected contract?
List of anchor assets available for PSM at a3p-integration:
List of collateral of available open Vaults a3p-integration:
Based on the list above, it makes more sense to extend the mintHolder tests coverage by executing a swap via PSM.
Meaning: USDC_axl, USDC_grv, USDT_axl |
If we have a simple mechanism to describe which PSMs should be upgraded in which environment, there's no reason not to do them all in a3p. |
Following the suggested design, I updated the Then it will iterate through this list, and for each asset, it constructs an object containing the following attributes:
The Currently, the assets DAI_axl, DAI_grv, and USDC are excluded due to the following issues:
I am actively working to resolve these issues, as well as updating the core-eval proposal to rely on the installation rather than only the label. @Chris-Hibbert do you agree with the test design currently implemented? |
Yep, seems fine. |
During the execution of a PSM swap for DAI variants, an issue was encountered. Since this issue is outside the scope of the current pull request, I have opened a new issue (#10655) to address it separately. In mintHolder.test.js, I added a condition to skip the PSM swap when the asset label includes DAI. However, the test still verifies that the mintHolder contract is upgraded and that the payment is minted as expected. Additionally, I included an inline comment linking to the new issue and indicating that the condition should be removed once the issue is resolved. @Chris-Hibbert, does this approach allow us to proceed with landing this pull request? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The purpose of #10410 is to upgrade the mintHolder vats on mainNet. This PR seems to focus on testing. Will it include adding invocations to upgrade.go
?
This PR also only upgrades mintHolders for currencies associated with PSMs. What about BLD, stATOM, stkATOM, stTIA, and stOSMO?
I was hoping that we'd be able to set up upgrade.go
, so it could invoke upgrade mintHolders
with a list of labels or assets, rather than creating a separate proposal for each currency to be upgraded. If we can do that, then the test should also invoke a single proposal and pass in a specification of which vats/currencies to handle rather than creating separate proposals in package.json.
a3p-integration/proposals/z:acceptance/mint-test-submission/send-script.tjs
Outdated
Show resolved
Hide resolved
* Ensure that publicFacet holds an issuer by calling makeEmptyPurse, the | ||
* core-eval will throw if otherwise. | ||
*/ | ||
await E(publicFacet).makeEmptyPurse(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we verify that the method is present without calling it? try __getMethodNames__()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was not able to find an example of getMethodNames() being used on Agoric code, and while trying your suggestion it triggers the following error:
target has no method __getMethodNames__ , has [ 'burn', 'getAllegedName', 'getAmountOf', 'getAssetKind', 'getBrand', 'getDisplayInfo', 'isLive', 'makeEmptyPurse' ]
For that reason, I am invoking the makeEmptyPurse method itself
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like you probably tried E(publicFacet). __getMethodNames__()
. I think what we want is publicFacet. __getMethodNames__()
. (I realize this is surprising.) I've asked @dckc to confirm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When trying the implementation you suggested, the error function not found
is triggered.
I intend to address this subject on the office hours.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
calling makeEmptyPurse()
seems better than bothering with __getMethodNames__()
.
b97559d
to
4468330
Compare
Regarding the mintHolder upgrade core-eval, the implementation has been enhanced to use the endowments.scriptArgs for passing a list of assets to be updated. This allows all mintHolder vats to be upgraded in a single proposal, eliminating the need for separate proposals per Label.
I have updated the test design in order to execute a single submission and verify that, according to the network configuration provided, all bankAssets listed on Vstorage that has a respective mintHolder Vat were successfully upgraded. For all the assets identified in the step above, the mintHolder test will mint a payment and verify the wallet balance. @Chris-Hibbert I hope that this new design provides the testing coverage intended.
Yes, it is planned to add the upgrade-mintHolder.js to upgrade.go, although, due to the fact that it receives a list of assets as argument, I am trying to better understand the behaviour of |
@@ -10,13 +10,14 @@ | |||
"testing/test-upgraded-board.js testUpgradedBoard", | |||
"vats/upgrade-agoricNames.js agoricNamesCoreEvals/upgradeAgoricNames", | |||
"testing/add-USD-OLIVES.js agoricNamesCoreEvals/addUsdOlives", | |||
"testing/publish-test-info.js agoricNamesCoreEvals/publishTestInfo" | |||
"testing/publish-test-info.js agoricNamesCoreEvals/publishTestInfo", | |||
"vats/upgrade-mintHolder.js upgrade-mintHolder USDC_axl USDT_grv DAI_axl DAI_grv stATOM USDC_grv ATOM USDT_axl USDC BLD IST" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no mintholder
for IST. What can we add to alert us when one of the requested upgrades isn't possible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially, I used an assertion on the core-eval to verify that a mintHolder contract kit existed for each asset label. However, because IST was the last item in the list, the test passed even when a mintHolder was missing.
To ensure that the core-eval process doesn't fail completely while still identifying issues, I added a condition (see here) . If the condition fails, an error is logged specifying the asset that couldn't be upgraded. However, the process continues without throwing an exception.
* Ensure that publicFacet holds an issuer by calling makeEmptyPurse, the | ||
* core-eval will throw if otherwise. | ||
*/ | ||
await E(publicFacet).makeEmptyPurse(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like you probably tried E(publicFacet). __getMethodNames__()
. I think what we want is publicFacet. __getMethodNames__()
. (I realize this is surprising.) I've asked @dckc to confirm.
82fe7d1
to
4c35d6e
Compare
The The asset lists used in upgrade-mintHolder.js for each chain variant were retrieved from the vbankAsset node using the Vstorage Viewer. The |
const networkConfig = { | ||
rpcAddrs: ['http://0.0.0.0:26657'], | ||
chainName: 'agoriclocal', | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be a default for getPSMChildren
? If this usage isn't doing anything unusual, it shouldn't have to specify this value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change request addressed
const [settlement] = await Promise.allSettled([ | ||
execa('agd', args, { all: true }), | ||
]); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is different from
const [settlement] = await Promise.allSettled([ | |
execa('agd', args, { all: true }), | |
]); | |
const settlement = await execa('agd', args, { all: true })); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After reviewing this change request, I realized that following the rebase to master, the file psm-lib.js
had already been included in the upgrade-19 proposal's test library. To avoid duplicating code, I removed psm-helpers.js
and updated psm-lib.js with the missing functions.
Regarding the implementation of sendOfferAgd
, it was copied from z:acceptance/test-lib/psm-lib.js. The use of Promise.allSettled()
was introduced in this commit by Richard Gibson.
While I am unsure of the specific rationale behind this design, the change you suggested triggers an error because the expected structure of the settlement object is not provided.
For these reasons, I plan to leave psm-lib.js as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's different: await
throws if the promise rejects. allSettled
does not.
sendOfferAgd
seems to report a rejection as a return value rather than throwing. Odd, but presumably expedient.
e960919
to
aa864ce
Compare
closes: #10410
Description
This pull request intends to ensure that the mintHolder contract continues to function as expected after a null upgrade.
Key Changes:
core-eval
was built, which acordingly to the agoric chain variant, will select a list of vbankAsset and execute a null upgrade to the respective mintHolder contract of each suitable asset.mintHolder.test.js
, has been added to the a3p-integration to verify the core-eval behaviour.MintHolder Test Plan:
- Mint a payment for each selected asset
- Deposit the payment into the receiver's depositFacet
Security Considerations
The execution of
mintHolder.test.js
had to be done prior to the./genesis-test.sh
acceptance test. Otherwise it would trigger the errorbundle ${id} not loaded
during theevalBundle
call.See this issue for more detail: #10620
Scaling Considerations
This PR does not introduce any change to the mintHolder source code, or how it is being consumed. For this reason that are no scaling considerations to be made.
Documentation Considerations
Testing Considerations
The implemented test design is expecting to have a core-eval for each mintHolder being updated.
If desired, this could be refactored to have a single core-eval executing a null upgrade to a predefined list of assets.
The second approach has the advantage of reducing the number of files being created, although it may hinder the testing flexibility.
Which approach is more desirable?
Upgrade Considerations